function [eqindx,ineqindx,boundindx] = feasiblecheck(pigrid,Aeq,beq,Aineq,bineq,lb,ub,feastol) 
eqindx    = ones(1,length(pigrid(1,:))) ; 
ineqindx  = ones(1,length(pigrid(1,:))) ; 
boundindx = ones(1,length(pigrid(1,:))) ;
for ll=1:length(eqindx)
    if sum(Aeq*pigrid(:,ll)~=beq) > 0 
        eqindx(ll) = 0 ;
    end
    if sum(Aineq*pigrid(:,ll)>bineq+feastol) > 0 
        ineqindx(ll) = 0 ;
    end
    if sum(pigrid(:,ll)<lb-feastol | pigrid(:,ll)>ub+feastol) > 0 
        boundindx(ll) = 0 ;
    end
end

end